//
//  AlertControllerCustom.m
//  AiyiAlbum
//
//  Created by iKing on 2017/4/12.
//  Copyright © 2017年 iKing. All rights reserved.
//

#import "UIAlertControllerCustom.h"

@implementation UIAlertActionCustom
- (instancetype)init {
    self = [super init];
    if (self) {
//        + (instancetype)actionWithTitle:(NSString *)title style:(UIAlertActionStyle)style handler:(void (^)(UIAlertAction * _Nonnull))handler {
//            UIAlertAction *action = [super actionWithTitle:title style:style handler:handler];
//            [action setValue:UIColorWithRGB(77, 77, 77) forKey:@"_titleTextColor"];
//            return (UIAlertActionCustom *)action;
//        }
        [self setValue:UIColorWithRGB(77, 77, 77) forKey:@"_titleTextColor"];
    }
    return self;
}
@end

@interface UIAlertControllerCustom ()

@end

@implementation UIAlertControllerCustom

- (void)viewDidLoad {
    [super viewDidLoad];
    if (self.title == nil || self.message == nil) {
        return;
    }
    NSMutableAttributedString *attrTitle = [[NSMutableAttributedString alloc] initWithString:self.title];
    [attrTitle addAttribute:NSForegroundColorAttributeName value:UIColorBlack range:NSMakeRange(0, self.title.length)];
    [self setValue:attrTitle forKey:@"attributedTitle"];
    
    NSMutableAttributedString *attrMsg = [[NSMutableAttributedString alloc] initWithString:self.message];
    [attrTitle addAttribute:NSForegroundColorAttributeName value:UIColorWithRGB(77, 77, 77) range:NSMakeRange(0, self.title.length)];
    [self setValue:attrMsg forKey:@"attributedMessage"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
